package Text1;

import java.util.*;

/*
 *@Student 张策
 */
public class text1 {
    public static void main(String[] args) {
        Collection lixt1 = new ArrayList();
        lixt1.add(new Book("dop"));
        lixt1.add(new Book("西游记"));
        lixt1.add(new Book("红楼梦"));
        for(Object book:lixt1){
            System.out.println(book);
        }
        
//        Iterator iterator = lixt1.iterator();
//        while (iterator.hasNext()) {
//            iterator.next();
//        }
//        iterator=lixt1.iterator();
//        System.out.println(iterator.next());
//        while (iterator.hasNext()){
//            System.out.println(iterator.next());
//        }
    }
}
class Book{
    String name;

    public Book(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "Book{" +
                "name='" + name + '\'' +
                '}';
    }
}
